package com.itheima.demo09;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ServiceDemo02 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10013);
        Socket accept = ss.accept();
        BufferedReader br = new BufferedReader(new InputStreamReader(accept.getInputStream()));
        String line;
        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }

        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("接收到数据！");
        bw.flush();
        accept.close();
        ss.close();
        br.close();
        bw.close();
    }
}
